package cn.edu.scau.cmi.liujianxun.client.fxUI.adapter;

import cn.edu.scau.cmi.liujianxun.adapter.*;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.ComboBox;

public class AdapterDemoController {
	@FXML
	private TextArea textArea;
	@FXML
	private ComboBox<String> comboBox;
	@FXML
	private Button button;

	String[] s = { AdapterOfClass.resultVoltage, AdapterOfObject.resultVoltage};
	
	public AdapterDemoController() {
	}
	
	public void init() {
		comboBox.getItems().addAll(s);
	}
	
	public void btEvent(ActionEvent event) {
		String i = comboBox.getValue();
		switch (i) {
		case "110V":
			TargetOfClass target1 = new AdapterOfClass();
			textArea.appendText(target1.doTarget() + "\n");
			break;
		case "5V":
			TargetOfObject target2 = new AdapterOfObject();
			textArea.appendText(target2.doTarget() + "\n");
			break;
		default: break;
		}
	}
}
